home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-05-01 | 3.8 KB | 142 lines | [TEXT/MPS ] |
- % ---------------------------------------------------------------------------
- % Class MACControlMrg
- %
- % In this module you find the programmers interface to Controls.
- % It is built on top of the TOOLBOX routines in TOOLBOXControls.
- % For a description of the routines see Inside Macintosh, chapter 10.
- %
- %
- % 890317/Boris Magnusson
- % 890408/Göran Eriksson
- %
- % ---------------------------------------------------------------------------
- % Datastructures used in Control Manager
- %
- % ControlPtr = ^ControlRecord;
- %
- % ControlRecord = PACKED RECORD
- % nextControl: ControlHandle;
- % contrlOwner: WindowPtr;
- % contrlRect: Rect;
- % contrlVis: Byte;
- % contrlHilite: Byte;
- % contrlValue: INTEGER;
- % contrlMin: INTEGER;
- % contrlMax: INTEGER;
- % contrlDefProc: Handle;
- % contrlData: Handle;
- % contrlAction: ProcPtr;
- % contrlrfCon: LONGINT;
- % contrlTitle: Str255;
- % END; {ControlRecord}
- external text procedure Text_String="::SInterfaces:Text_String";
- external class MacControl="::SInterfaces:MacControl";
- external class MacRect="::SInterfaces:MacRect";
- external class MacPoint="::SInterfaces:MacPoint";
- external class MacWindow="::SInterfaces:MacWindow";
- External class ToolboxControl ="::SInterfaces:ToolboxControl";
- Simset class MACControlMgr;
- begin
- ref(ToolboxControl) TB;
-
- % PROCEDURE DisposeControl(theControl: ControlHandle);
- PROCEDURE DisposeControl(theControl);
- ref(MacControl) theControl;
- begin
- TB.ToolboxDisposeControl(theControl.Controlptr);
- ConvertToNotice(theControl).Out;
- end;
-
- % PROCEDURE KillControls(theWindow: WindowPtr);
- PROCEDURE KillControls(theWindow);
- ref(MacWindow) theWindow;
- begin
- TB.ToolboxKillControls(theWindow.WindowPtr);
- KillControlsInWindow(theWindow);
- end;
-
- procedure RegisterControl(C, W); ref(MacControl) C; ref(MacWindow) W;
- new ControlNotice(C, W);
-
-
- % FUNCTION FindControl(thePoint: Point; theWindow: WindowPtr;
- % VAR theControl: ControlHandle): INTEGER;
- short integer procedure FindControl(thePoint, theWindow, theControl);
- name theControl;
- ref(MacPoint) thePoint;
- ref(MacWindow) theWindow;
- ref(MacControl) theControl;
- begin
- integer C;
- FindControl:=TB.ToolboxFindControl(thePoint.h,thePoint.v,
- theWindow.WindowPtr, C);
- theControl:-ConvertToControl(C);
- end;
-
- % PROCEDURE DrawControls(theWindow: WindowPtr);
- PROCEDURE DrawControls(theWindow);
- ref(MacWindow) theWindow;
- TB.ToolboxDrawControls(theWindow.WindowPtr);
-
-
- % {new 128K ROM}
-
- % PROCEDURE UpdtControl(theWindow: WindowPtr; updateRgn: RgnHandle);
- % external TB.Toolbox procedure x="$A953" is
- % PROCEDURE UpdtControl(theWindow, updateRgn);
- % integer theWindow;
- % integer updateRgn;;
-
- % PROCEDURE Draw1Control(theControl: ControlHandle);
- % external TB.Toolbox procedure x="$A96D" is
- % PROCEDURE Draw1Control(theControl);
- % integer theControl;
-
- % ----------------------------------------------
- % internal routines
-
- ref(MACControl) procedure ConvertToControl(ControlPtr);
- integer ControlPtr;
- begin
- ref(ControlNotice) Temp;
- Temp:-ControlQue.first;
- while temp=/= none and then Temp.C.ControlPtr<>ControlPtr do
- temp:-temp.suc;
- if temp=/= none then
- ConvertToControl:-temp.C;
- end;
-
- ref(ControlNotice) procedure ConvertToNotice(C); ref(MacControl) C;
- begin
- ref(ControlNotice) Temp;
- Temp:-ControlQue.first;
- while temp=/= none and then Temp.C=/=C do
- temp:-temp.suc;
- ConvertToNotice:-temp;
- end;
-
- procedure KillControlsInWindow(W); ref(MacWindow) W;
- begin
- ref(ControlNotice) Temp,TempOut;
- Temp:-ControlQue.first;
- while temp =/= none do
- begin
- if temp.W==W then
- begin
- tempOut:-temp;
- temp:-temp.suc;
- tempOut.out;
- end
- else
- temp:-temp.suc;
- end;
-
- end;
-
- link class ControlNotice(C,W); ref(MACControl) C; ref(MacWindow) W;
- into(ControlQue);
- % ----------------------------------------------
- ref(Head) ControlQue;
- TB:-new ToolboxControl;
- ControlQue:-new Head;
- end;